<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>米尔豪斯酒店后台管理系统</title>
	<link rel="stylesheet" type="text/css" href="../css/consult.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="../css/page.css">
	<script type="text/javascript" language="javascript">
		function confirmAct() {
		   if(confirm('确定要退出登陆吗?') == true) {
		   	　window.location.href="../html/admin_login.html";
   			}
		}
        function consult_delete(id) {
            window.location.href = "consult_delete.php?id="+id;
        }
        function consult_editor(consult_id) {
            window.location.href = "consult_editor.php?consult_id="+consult_id;
        }
	</script>
</head>
<body>
	<div class="all">	
		<div class="all1">
			<h1>米尔豪斯酒店后台管理系统</h1>
		</div>

        <?php include './menu.php'?>

		<div class="all3" >
			<div class="guide">
				<p><img src="../img/主页.png">&nbsp;&nbsp;当前位置 ： 后台管理 > 留言管理 </p>
			</div>
			<div class="data">
					<div class="add">
						<a href="consult_add.php"><img src="../img/添加.png">&nbsp;添加</a>
					</div>
					<div class="content">
						<table class="table table-hover table-responsive">
							<thead>
								<tr>
									<th width="">ID</th>
									<th width="">用户名</th>
									<th width="200px">留言</th>
									<th width="">留言时间</th>
									<th width="">操作选项</th>
								</tr>
							</thead>
    <?php
    session_start();
    header("Content-type:text/html;charset=utf-8");
    include "../../lib/DB.php";
    include "../../lib/Pagination.php";
    $db = new DB();
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $pageSize = isset($_GET['pageSize']) ? abs($_GET['pageSize']) : 10;
    $goods = $db->table('liuyan')->page($page,$pageSize)->order('id desc')->select();
    $count = "select count(*) as count from  liuyan";
    $goodsCount = $db->table('liuyan')->query($count)['0']['count'];
    $pagination = new Pagination($goodsCount,$pageSize);
    $num = 0;
    ?>
        <?php foreach ($goods as $k =>  $row):?>
        <tr>
            <td><?php echo $num+$k+1 ?></td>
            <td><?php echo $row['user_name'] ?></td>
            <td><?php echo $row['content'] ?></td>
            <td><?php echo $row['createtime'] ?></td>
            <td>
                <button class="btn btn-info btn-xs" onclick="javascript:consult_editor(<?php echo $row['id']?>)">编辑</button>&nbsp;&nbsp;
                <button class="btn btn-danger btn-xs" onclick="javascript:consult_delete(<?php echo $row['id']?>)">删除</button></td>
        </tr>
        <?php endforeach;?>

						</table>
					</div>
                <?php echo $pagination->links()?>
			</div>
		</div>
		<div class="all4">
			<h3>米尔豪斯酒店</h3>
		</div>
	</div>
</body>
</html>